<?php

use App\Http\Controllers\Api\V1\ArticleContorller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::match(['get','post'],'v1/user/register','App\Http\Controllers\Api\V1\UserController@register');
Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::post('v1/user/register','App\Http\Controllers\Api\V1\UserController@register');
Route::post('v1/user/login','App\Http\Controllers\Api\V1\UserController@login');

Route::middleware(['apitoken'])->get('v1/user/logout','App\Http\Controllers\Api\V1\UserController@logout');
Route::middleware(['apitoken'])->post('v1/user/avatar','App\Http\Controllers\Api\V1\UserController@avatar');

Route::middleware(['apitoken'])->get('v1/article/myindex','App\Http\Controllers\Api\V1\ArticleController@myindex');
Route::resource('v1/article',ArticleContorller::class);

Route::get('common/sms','App\Http\Controllers\Api\Common\SmsController@send');
Route::get('common/smscheck','App\Http\Controllers\Api\Common\SmsController@check');
Route::middleware(['apiguest'])->post('v1/user/smslogin','App\Http\Controllers\Api\V1\UserController@smslogin');
Route::post('v1/user/smspw','App\Http\Controllers\Api\V1\UserController@smspw');

Route::get('common/ver','App\Http\Controllers\Api\Common\VerController@index');

Route::middleware(['apiguest'])->post('common/uni/min','App\Http\Controllers\Api\Common\UniController@min');
Route::middleware(['apiguest'])->post('common/uni/app','App\Http\Controllers\Api\Common\UniController@app');

Route::post('common/pay/notify','App\Http\Controllers\Api\Common\PayController@notify');
